package org.example.deep.dao;

import org.example.deep.entity.ElecAnalyseFile;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ElecAnalyseFileRepository extends JpaRepository<ElecAnalyseFile, Long> {
    @Query(nativeQuery = true, value = "select SEQ_ELEC_ANALYSE_FILE.NEXTVAL FROM DUAL")
    long findSeq();

    @Query(nativeQuery = true, value = "select * from ELEC_ANALYSE_FILE where FILE_TYPE=?1")
    ElecAnalyseFile findTemplate(Integer fileType);

    @Query(nativeQuery = true, value = "select * from ELEC_ANALYSE_FILE where FILE_TYPE=?1 ORDER BY FILE_NAME DESC")
    List<ElecAnalyseFile> findAllFile(Integer fileType);

    @Query(nativeQuery = true, value = "select * from ELEC_ANALYSE_FILE where FILE_NAME=?1 AND FILE_TYPE=?2")
    ElecAnalyseFile findByFileName(String fileName, Integer fileType);

}